﻿<%@ Page Title="Cungmuanao.com - Quản lý liên kết" Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true" CodeFile="ManageLinks.aspx.cs" Inherits="Admin_ManageLinks" %>
<%@ Import Namespace="DTO" %>
<%@ Register src="../Controls/FileUpload.ascx" tagname="FileUpload" tagprefix="uc1" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="LeftContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <div class="title">Quản lý liên kết</div>
    <div class="body">
    
<asp:GridView runat="server" ID="gvwPartners" Width="100%" 
        AutoGenerateColumns="False" DataSourceID="objAllPartners" DataKeyNames="ID"
        AllowPaging="True" EmptyDataText="<b>Chưa có Banner nào</b>"
        onrowcreated="gvwPartners_RowCreated" 
        onrowdeleted="gvwPartners_RowDeleted" 
        onselectedindexchanged="gvwPartners_SelectedIndexChanged">
    <Columns>
         <asp:TemplateField HeaderText="STT" >
            <ItemStyle HorizontalAlign="Center" Width="20" />
            <ItemTemplate>
                <asp:Literal runat="server" ID="lblSTT" Text='<%#Container.DataItemIndex + 1 %>' />
            </ItemTemplate>
        </asp:TemplateField>
        
        <asp:TemplateField HeaderText="Tiêu đề">
            <ItemTemplate>
                <asp:Literal runat="server" ID="lblTitle" Text='<%#Eval("Title")  %>'  />
            </ItemTemplate>
        </asp:TemplateField>        
        
        <asp:TemplateField HeaderText="Mức độ">
            <ItemTemplate>
                <asp:Literal runat="server" ID="lblimportance" Text='<%#Eval("Importance")%>' />
            </ItemTemplate>
        </asp:TemplateField>
        
        <asp:TemplateField HeaderText="website">
            <ItemTemplate>
                <asp:Literal runat="server" ID="lblwebsite" Text='<%#Eval("Website")%>' />
            </ItemTemplate>
        </asp:TemplateField>
        
        <asp:TemplateField HeaderText="Ghi chú">
            <ItemTemplate>
                <asp:Literal runat="server" ID="lbldescription" Text='<%#Eval("Description")%>' />
            </ItemTemplate>
        </asp:TemplateField>                
        
        <asp:CommandField HeaderText="Edit" ButtonType="Image" SelectImageUrl="~/Images/edit.gif"
                SelectText="Edit" ShowSelectButton="True">
                <ItemStyle HorizontalAlign="Center" Width="20" />
        </asp:CommandField>
        
        <asp:CommandField HeaderText="Delete" ButtonType="Image" DeleteImageUrl="~/Images/delete.gif"
                DeleteText="Delete" ShowDeleteButton="True">
                <ItemStyle HorizontalAlign="Center" Width="20" />
            </asp:CommandField>
    </Columns>
 </asp:GridView>
 
        <asp:ObjectDataSource ID="objAllPartners" runat="server" 
            DeleteMethod="DeletePartner" SelectMethod="GetPartnerByPartnerCatID" 
            TypeName="BLL.Pages.Partners">
            <DeleteParameters>
                <asp:Parameter Name="id" Type="Int32" />
            </DeleteParameters>
            <SelectParameters>
                <asp:Parameter DefaultValue="1" Name="PartnerCatID" Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>
 
<p></p>

<asp:DetailsView runat="server" ID="dvwCurrPartner" DefaultMode="Insert"
        AutoGenerateRows="False" DataKeyNames="ID" Width="100%" 
            AutoGenerateInsertButton="True" AutoGenerateEditButton="True" 
    DataSourceID="objCurrPartner" onitemcommand="dvwCurrPartner_ItemCommand" 
        oniteminserted="dvwCurrPartner_ItemInserted" 
        onitemupdated="dvwCurrPartner_ItemUpdated">
    <Fields>
        <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="true" InsertVisible="false"
               SortExpression="ID" />
         <asp:BoundField DataField="AddedDate" HeaderText="Ngày t&#7841;o" InsertVisible="False"
            ReadOnly="True" SortExpression="AddedDate" />
         <asp:BoundField DataField="AddedBy" HeaderText="Ng&#432;&#7901;i t&#7841;o" InsertVisible="False" ReadOnly="True"
            SortExpression="AddedBy" />                
        <asp:TemplateField HeaderText="Tiêu đề">
            <EditItemTemplate>
                <asp:TextBox runat="server" ID="txtName" Text='<%#Bind("Title") %>' Width="99%" />
                <asp:RequiredFieldValidator ID="valRequireName" runat="server" ControlToValidate="txtName" SetFocusOnError="true"
                  Text="Bắt buộc nhập tiêu đề" ToolTip="Bắt buộc nhập tiêu đề" Display="Dynamic"></asp:RequiredFieldValidator>
            </EditItemTemplate>
        </asp:TemplateField>            
        
        <asp:TemplateField HeaderText="Mức độ">
            <EditItemTemplate>
                <asp:TextBox runat="server" ID="txtNumber" Text='<%#Bind("Importance") %>' Width="99%" />
            </EditItemTemplate>
        </asp:TemplateField>
        
        <asp:TemplateField HeaderText="Link">
            <EditItemTemplate>
                <asp:TextBox runat="server" ID="txtWebsite" Text='<%#Bind("Website") %>' Width="99%" />
            </EditItemTemplate>
        </asp:TemplateField>
         <asp:CommandField ButtonType="Image" CancelImageUrl="~/Images/nhaplai.png" 
          CancelText="Nhập  lại" InsertImageUrl="~/Images/themmoi.png" 
          InsertText="Thêm mới" ShowInsertButton="True" ShowEditButton="True"
          UpdateImageUrl="~/Images/capnhat.png" UpdateText="Cập nhật" />        
    </Fields>
    </asp:DetailsView>
    
    <asp:ObjectDataSource runat="server" ID="objCurrPartner" TypeName="BLL.Pages.Partners" SelectMethod="GetPartner" 
    InsertMethod="InsertPartner" UpdateMethod="UpdatePartner">
        <SelectParameters>
            <asp:ControlParameter PropertyName="SelectedValue" ControlID="gvwPartners" Type="Int32" Name="PartnerID" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="title" Type="String" />
            <asp:Parameter Name="logo" Type="String" DefaultValue=""/>
            <asp:Parameter Name="importance" Type="Int32" />
            <asp:Parameter Name="website" Type="String" />
            <asp:Parameter Name="description" Type="String" DefaultValue=""/>
            <asp:Parameter Name="partnerCatID" Type="Int32" DefaultValue="1" />
            <asp:Parameter Name="option" Type="Int32" DefaultValue="0" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="id" Type="Int32" />
            <asp:Parameter Name="title" Type="String" />
            <asp:Parameter Name="logo" Type="String" DefaultValue=""/>
            <asp:Parameter Name="importance" Type="Int32" />
            <asp:Parameter Name="website" Type="String" />
            <asp:Parameter Name="description" Type="String" DefaultValue=""/>
            <asp:Parameter Name="partnerCatID" Type="Int32" DefaultValue="1" />
        </UpdateParameters>
    </asp:ObjectDataSource>
    </div>
    <div class="bottom"></div>
</asp:Content>

